<template>
    <div class="pagination-template">
        <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage"
                :page-sizes="pageSizes"
                :page-size="pageSize"
                :layout="layout"
                :total="total">
        </el-pagination>
    </div>
</template>

<script>
    export default {
        name: "Pagination",
        props: {
            currentPage: {
                required: true,
                type: Number,
            },
            pageSizes: {
                required: true,
                type: Array,
            },
            pageSize: {
                required: true,
                type: Number,
            },
            layout: {
                required: false,
                type: String,
                default: () => {
                    return "total, sizes, prev, pager, next, jumper"
                }
            },
            total: {
                required: true,
                type: Number,
            }
        },
        data() {
            return {}
        },
        methods: {
            handleSizeChange(val) {
                this.$emit('sizeChangeEvent', val);
            },
            handleCurrentChange(val) {
                this.$emit('currentChangeEvent', val);
            }
        }
    }
</script>

<style lang="scss">
    .pagination-template {

    }
</style>